package com.springcloudexample.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RequestMapping("/ribbon")
@RestController
public class RibbonHandler {

    @Autowired
    private RestTemplate restTemplate;

    /**
     * 直接访问 Provider 在 Eureka Server 注册的 application name 即可
     * @return
     */
    @GetMapping("/index")
    public String index(){
        return restTemplate.getForObject("http://eureka-client/index",String.class);
    }

}
